import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "node:path";
import { resolve } from "path";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        createSvgIconsPlugin({
            // 指定需要缓存的图标文件夹
            iconDirs: [path.resolve(process.cwd(), "@/assets/svg")],
            // 指定symbolId格式
            symbolId: "[name]",
        }) as any,
    ],
    server: {
        host: "0.0.0.0", // 这个用于启动
        port: 81, // 指定启动端口
        open: false, //启动后是否自动打开浏览器
    },
    resolve: {
        // 设置文件./src路径为 @
        alias: [
            {
                find: "@",
                replacement: resolve(__dirname, "./src"),
            },
        ],
    },
});
